#include <stdio.h>
#include <string.h>
#define MAXN 1010
#define DIGIT 15
#define MIN(x, y) (((x) < (y)) ? (x) : (y))

int designer[MAXN], breaker[MAXN], dcnt[DIGIT], bcnt[DIGIT];

int main() {
  int g = 0, n, i, a, b;
  
  while (scanf("%d", &n) == 1) {
    if (!n) {
      break;
    } else {
      printf("Game %d:\n", ++g);
    }
    
    memset(dcnt, 0, sizeof(dcnt));
    for (i = 0; i < n; i++) {
      scanf("%d", &designer[i]);
      dcnt[designer[i]]++; 
    }
    
    while (1) {
      a = b = 0;
      memset(bcnt, 0, sizeof(bcnt));
      for (i = 0; i < n; i++) {
        scanf("%d", &breaker[i]);
        bcnt[breaker[i]]++;
        
        if (designer[i] == breaker[i]) {
          a++;
        }
      }
      
      if (!breaker[0]) {
        break;
      }
      
      for (i = 1; i <= 9; i++) {
        b += MIN(dcnt[i], bcnt[i]);
      }
      
      printf("    (%d,%d)\n", a, b - a);
    }
  }
  
  return 0;
}